home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_c
/
cug103
/
edit.doc
< prev
next >
Wrap
Text File
|
1985-03-10
|
10KB
|
325 lines
The Fantastic Great Wonderful EDIT
by Scott Fluhrer
and Neal Somos
This file created May 7, 1981 by Kathy Bacon.
This is supposed to be a help file for Scott's QED editor
in BDS C. When in EDIT itself, you can get a brief listing of the
available commands, but here I tried to give a little more explan-
ation and a few examples of some of the niftier features, for anyone
who hasn't used an editor of this type before.
EDIT can be invoked by typing
A>EDIT x:filename <cr>
where both the filename and drive designation are optional.
Comment 1) After any change that rearranges lines, the line
numbers are automatically adjusted, so it's a good idea to look at the
code again before you make any more changes, to check out the new line
numbers - unless you LIKE suprise deletions and substitutions, in which
case, by ALL MEANS go ahead and live dangerously!
Comment 2) Whenever I say, "specified range of lines", I mean
two numbers separated by a comma, like 1,3 or 10,999.
Comment 3) A dollar sign ($) stands for the last line of
the file; within a search string it stands for end-of-line. A period
(.) stands for the current line in the file; within a search string
it stands for "any character" - a sort of wild card.
********************************************************************
Miscellaneous Commands
********************************************************************
COMMAND DESCRIPTION
Control-P Will send everything typed on the screed thereafter
to the printer. To stop, type another Control-P.
h Will list a brief description of all commands
u This is the "user-defined-command". To set it, you
just say u=com and u is set equal to "com".
"com" can be anything you want - a complicated
search-and-substitute you'll be doing a lot,
a ".,$" , or whatever.
# Toggles the line numbers on or off.
< Turns the prompts on.
> Turns the prompts off.
= Has various uses:
f=file sets default filename to "file"
$= tells you last line number
.= tells you current line number (useful if
you've turned off the numbers)
u=com sets the user command to "com"
u= tells you what the user command is
***************************************************************
Commands Concerning Files
***************************************************************
I know, I know, they're ALL concerned with files, but read on...
COMMAND
r x:filename Reads in file "filename" from drive x. The default
is the currently logged in disk if no designation
is given.
w x:filename Writes "filename" to disk x. Again, "x" is optional.
So, for that matter, is the filename: if you don't
specify, it will use the current default filename
(there is a default even if you've never specified
one during your EDITing - it USED to write out a
file with the descriptive title " ", but that wasn't
too cool...)
f Tells you the current default filename.
f=file Sets the default filename to "file".
q Quits the editor. If you try to quit without first
writing the file (via "w") to disk, EDIT will scream
(well, ACTUALLY it will only BEEP) at you. If you
don't want your most recent changes anyway, and you
find this behavior obnoxious, read on...
q! Quits quietly.
n x:filename This command will cause "filename" to be read form
drive x and be used to EDIT the file you are in -
i.e. "filename" should be a file of EDIT commands.
This can be used to add one of your files to
another (there's no explicit command for this).
Copy the text you want to add into a file, precede
it with an "a" for append, and follow it with a
period ".", and then use the file to EDIT the
file you want to add the text to.
NOTE!! If a filename is not specified, it will use the
current default filename - which will probably
NOT contain EDIT commands....
****************************************************************
Commands Concerning Lines
****************************************************************
(line#)a APPENDS lines of text AFTER the (optional) line
number. To stop, type a single period (.) on a line.
(line#)ac APPEND COMMENT to (line#). This will automatically
add a "/*" onto the line you specify - you then
type in the text of your comment, and hit <cr>,
and it adds the closing "*/".
(range)c CHANGES the line or lines specified. To stop, type
a single period on a line.
(range)d DELETES the line or range of lines specified.
(line#)i INSERTS lines of text BEFORE the (opt.) line
number. To stop, type a single period (.) on a
line.
(line#)j JOINS the line following "line#" to the end
of "line#", making the two one line.
(range)m(dest) MOVES the range of lines specified to the
destination specified. They are deleted from
their original location.
(range)t(dest) COPIES the range of lines specified to the
destination specified. The lines are NOT
deleted form their original location.
Example:
141>a
142 line one of ridiculous text
143 line two
144 third boring line
145 fourth insipid line
146 boring boring boring
147 .
146>142,143m146
146>142,146
142 third boring line
143 fourth insipid line
144 line one of ridiculous text
145 line two
146 boring boring boring
146>146t142
146>142,147
142 boring boring boring
143 third boring line
144 fourth insipid line
145 line one of ridiculous text
146 line two
147 boring boring boring
***********************************************************
Print Commands
***********************************************************
All line number designations for these commands are OPTIONAL.
--------------------------------------------------
(line#)p Displays the line designated, and sets dot (.) to
"line#".
(range)l Displays the range of lines specified, showing
all control characters as up-arrows followed
by some character. A tab (^I) is the only control
character that this editor ALLOWS you to put in,
but other sneaky little devils culd creep in...
(range) Displays the range specified with all control
characters shown as an up-arrow followed by a
letter . The only control character this editor
will allow you to insert is a tab (^I) but others
may creep in, the sneaky little devils.
(line#): Prints from (line#) to (line# + 16); sets dot equal
to (line#).
(line#)& Prints from (line# - 16) to (line#), leaves dot at
(line#).
(line#)" Prints from (line# + 1) up to (line# + 17), leaves
dot at (line#).
(line#)~ Prints from (line# - 16) up to (line#), sets dot
to (line# - 16).
(line#)% Prints from (line# - 8) up to (line# + 8) to
show the context of a line.
*****************************************************************
Search and Substitute Commands
*****************************************************************
These come in several flavors.....depending on your tastes...
The General "Searches":
----------------------
/string/ Will search FORWARD through the file for the next
occurrence of "string", and print it out.
?string? Will search BACKWARD through the file for the last
occurrence of "string". A "print" is implied.
g/string/ Will search and print out all occurrences of
"string" in the file.
v/string/ Will print out all lines in the file which DO
NOT contain "string".
The "Search and Substitutes":
---------------------------
(range)s/search/replace/ Will substitute "replace" for the
FIRST occurrence of "search" on all
lines in "range".
(range)s/search/replace/p Will do the same, but will print the
final result.
(range)s/search/replace/gp Will substitute for ALL occurrences
on each line.
The "Interactive Substitute":
----------------------------
(range)x/search/replace/p Will search and display each
occurrence (singly, of course!)
of "search" in "range". The search
string will be marked on each
line by up-arrows (^); if a tab is
in the search string it will be marked
by vertial lines (|).
After displaying the search string,
it will wait for you to reply :
type a period (.), and it will
do the substitution of "replace"
for "search"; answer with a carriage
return <cr> and it will NOT.
A "/" is generally used to delimit the search and replace
strings, but another character can be used, like a "@".
--------------------------------------------------
There are also some "special characters" that can appear in
these "search" and "replace" strings:
CHARACTER MEANING
& In a "replace" string, "&" stands for the string
you just searched for.
$ In a "search" string, stands for the end-of-line.
^ Stands for the beginning-of-line.
* Zero, one, or many of the character immediately
following it.
. A "wild-card": any character.
~ "not" character: a match will occur for anything
EXCEPT the character immediately following the "~".
You could try to find "th~is", for example. This
is especially useful if you're a lousy speller.
\ The "force" character: if you want to actually
look for a string containing one of these special
characters, precede it with a "\" to "force" it
into the string.
Some Example Substitutions:
--------------------------
309>a
310 I think I am losing my mind.
311 .
310>s/t*.n/am so bore/p
310 I am so bored.
310>s/so/& & & /p
310 I am so so so bored.
310>a
311
312 snore (snooze) /* a boring function */
313 .
312>s/(*~)/&,fizzle/p
312 snore (snooze, fizzle) /* a boring function */
312>s//&,zzzzz/p
312 snore (snooze, fizzle, zzzzz) /* a boring function */
312>
The combination "*." stands for any number of any character. Note
that it matches the LONGEST occurrence of the search string. This
is useful, but can be tricky if you're not careful.
Notice also that it will remember the last search string
if you just say //
, but can be tricky if you're not caref